#include "mainwidget.h"
#include "ui_mainwidget.h"

MainWidget::MainWidget(BaseWindow *parent) :
    BaseWindow(parent),
    ui(new Ui::MainWidget)
{
    ui->setupUi(this);

    m_titleBar->setTitleContent(QStringLiteral("贝壳找房"));
    m_titleBar->setButtonType(MIN_MAX_CLOSE_SETTING_BUTTON);
    m_titleBar->setTitleWidth(this->width());

    m_pStackedLayout = new QStackedLayout(ui->gridLayout);

    m_pAdminWidget = new AdminWidget(this);
    m_pUserWidget  = new UserWidget(this);
    m_pLoginWidget = new LoginWidget(this);

    m_pStackedLayout->addWidget(m_pLoginWidget);
    m_pStackedLayout->addWidget(m_pAdminWidget);
    m_pStackedLayout->addWidget(m_pUserWidget);

    connect(m_pLoginWidget, &LoginWidget::display,
            m_pStackedLayout, &QStackedLayout::setCurrentIndex);
}

MainWidget::~MainWidget()
{
    delete ui;
}
